home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / gnome-vfs-module-2.0 / libgnomevfs / gnome-vfs-method.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-05-01  |  9.6 KB  |  280 lines

  1. /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
  2. /* gnome-vfs-method.h - Virtual class for access methods in the GNOME
  3.    Virtual File System.
  4.  
  5.    Copyright (C) 1999, 2001 Free Software Foundation
  6.  
  7.    The Gnome Library is free software; you can redistribute it and/or
  8.    modify it under the terms of the GNU Library General Public License as
  9.    published by the Free Software Foundation; either version 2 of the
  10.    License, or (at your option) any later version.
  11.  
  12.    The Gnome Library is distributed in the hope that it will be useful,
  13.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the GNU
  15.    Library General Public License for more details.
  16.  
  17.    You should have received a copy of the GNU Library General Public
  18.    License along with the Gnome Library; see the file COPYING.LIB.  If not,
  19.    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20.    Boston, MA 02111-1307, USA.
  21.  
  22.    Author: Ettore Perazzoli <ettore@comm2000.it> 
  23.            Seth Nickell <snickell@stanford.edu>
  24. */
  25.  
  26. #ifndef GNOME_VFS_METHOD_H
  27. #define GNOME_VFS_METHOD_H
  28.  
  29. /*
  30.  * The following include helps Solaris copy with its own headers.  (With 64-
  31.  * bit stuff enabled they like to #define open open64, etc.)
  32.  * See http://bugzilla.gnome.org/show_bug.cgi?id=71184 for details.
  33.  */
  34. #ifndef _WIN32
  35. #include <unistd.h>
  36. #endif
  37.  
  38. #include <libgnomevfs/gnome-vfs-context.h>
  39. #include <libgnomevfs/gnome-vfs-file-info.h>
  40. #include <libgnomevfs/gnome-vfs-find-directory.h>
  41. #include <libgnomevfs/gnome-vfs-handle.h>
  42. #include <libgnomevfs/gnome-vfs-transform.h>
  43. #include <libgnomevfs/gnome-vfs-monitor.h>
  44.  
  45. G_BEGIN_DECLS
  46.  
  47. #define _GNOME_VFS_METHOD_PARAM_CHECK(expression)            \
  48.     g_return_val_if_fail ((expression), GNOME_VFS_ERROR_BAD_PARAMETERS);
  49.  
  50. typedef struct GnomeVFSMethod GnomeVFSMethod;
  51.  
  52. typedef GnomeVFSMethod * (* GnomeVFSMethodInitFunc)(const char *method_name, const char *config_args);
  53. typedef void (*GnomeVFSMethodShutdownFunc)(GnomeVFSMethod *method);
  54.  
  55. typedef GnomeVFSResult (* GnomeVFSMethodOpenFunc)
  56.                     (GnomeVFSMethod *method,
  57.                      GnomeVFSMethodHandle
  58.                             **method_handle_return,
  59.                      GnomeVFSURI *uri,
  60.                      GnomeVFSOpenMode mode,
  61.                      GnomeVFSContext *context);
  62.  
  63. typedef GnomeVFSResult (* GnomeVFSMethodCreateFunc)
  64.                     (GnomeVFSMethod *method,
  65.                      GnomeVFSMethodHandle
  66.                             **method_handle_return,
  67.                      GnomeVFSURI *uri,
  68.                      GnomeVFSOpenMode mode,
  69.                      gboolean exclusive,
  70.                      guint perm,
  71.                      GnomeVFSContext *context);
  72.  
  73. typedef GnomeVFSResult (* GnomeVFSMethodCloseFunc)
  74.                     (GnomeVFSMethod *method,
  75.                      GnomeVFSMethodHandle *method_handle,
  76.                      GnomeVFSContext *context);
  77.  
  78. typedef GnomeVFSResult (* GnomeVFSMethodReadFunc)
  79.                     (GnomeVFSMethod *method,
  80.                      GnomeVFSMethodHandle *method_handle,
  81.                      gpointer buffer,
  82.                      GnomeVFSFileSize num_bytes,
  83.                      GnomeVFSFileSize *bytes_read_return,
  84.                      GnomeVFSContext *context);
  85.  
  86. typedef GnomeVFSResult (* GnomeVFSMethodWriteFunc)
  87.                     (GnomeVFSMethod *method,
  88.                      GnomeVFSMethodHandle *method_handle,
  89.                      gconstpointer buffer,
  90.                      GnomeVFSFileSize num_bytes,
  91.                      GnomeVFSFileSize *bytes_written_return,
  92.                      GnomeVFSContext *context);
  93.  
  94. typedef GnomeVFSResult (* GnomeVFSMethodSeekFunc)
  95.                     (GnomeVFSMethod *method,
  96.                      GnomeVFSMethodHandle *method_handle,
  97.                      GnomeVFSSeekPosition  whence,
  98.                      GnomeVFSFileOffset    offset,
  99.                      GnomeVFSContext *context);
  100.  
  101. typedef GnomeVFSResult (* GnomeVFSMethodTellFunc)
  102.                     (GnomeVFSMethod *method,
  103.                      GnomeVFSMethodHandle *method_handle,
  104.                      GnomeVFSFileSize *offset_return);
  105.  
  106. typedef GnomeVFSResult (* GnomeVFSMethodOpenDirectoryFunc)
  107.                     (GnomeVFSMethod *method,
  108.                      GnomeVFSMethodHandle **method_handle,
  109.                      GnomeVFSURI *uri,
  110.                      GnomeVFSFileInfoOptions options,
  111.                      GnomeVFSContext *context);
  112.  
  113. typedef GnomeVFSResult (* GnomeVFSMethodCloseDirectoryFunc)
  114.                     (GnomeVFSMethod *method,
  115.                      GnomeVFSMethodHandle *method_handle,
  116.                      GnomeVFSContext *context);
  117.  
  118. typedef GnomeVFSResult (* GnomeVFSMethodReadDirectoryFunc)
  119.                     (GnomeVFSMethod *method,
  120.                      GnomeVFSMethodHandle *method_handle,
  121.                      GnomeVFSFileInfo *file_info,
  122.                      GnomeVFSContext *context);
  123.  
  124. typedef GnomeVFSResult (* GnomeVFSMethodGetFileInfoFunc)
  125.                     (GnomeVFSMethod *method,
  126.                      GnomeVFSURI *uri,
  127.                      GnomeVFSFileInfo *file_info,
  128.                      GnomeVFSFileInfoOptions options,
  129.                      GnomeVFSContext *context);
  130.  
  131. typedef GnomeVFSResult (* GnomeVFSMethodGetFileInfoFromHandleFunc)
  132.                     (GnomeVFSMethod *method,
  133.                      GnomeVFSMethodHandle *method_handle,
  134.                      GnomeVFSFileInfo *file_info,
  135.                      GnomeVFSFileInfoOptions options,
  136.                      GnomeVFSContext *context);
  137.  
  138. typedef GnomeVFSResult (* GnomeVFSMethodTruncateFunc) (GnomeVFSMethod *method,
  139.                                GnomeVFSURI *uri,
  140.                                GnomeVFSFileSize length,
  141.                                GnomeVFSContext *context);
  142. typedef GnomeVFSResult (* GnomeVFSMethodTruncateHandleFunc) (GnomeVFSMethod *method,
  143.                                  GnomeVFSMethodHandle *handle,
  144.                                  GnomeVFSFileSize length,
  145.                                  GnomeVFSContext *context);
  146.  
  147. typedef gboolean       (* GnomeVFSMethodIsLocalFunc)
  148.                     (GnomeVFSMethod *method,
  149.                      const GnomeVFSURI *uri);
  150.  
  151. typedef GnomeVFSResult (* GnomeVFSMethodMakeDirectoryFunc)
  152.                     (GnomeVFSMethod *method,
  153.                      GnomeVFSURI *uri,
  154.                      guint perm,
  155.                      GnomeVFSContext *context);
  156.  
  157. typedef GnomeVFSResult (* GnomeVFSMethodFindDirectoryFunc)
  158.                     (GnomeVFSMethod *method,
  159.                      GnomeVFSURI *find_near_uri,
  160.                      GnomeVFSFindDirectoryKind kind,
  161.                      GnomeVFSURI **result_uri,
  162.                      gboolean create_if_needed,
  163.                      gboolean find_if_needed,
  164.                      guint perm,
  165.                      GnomeVFSContext *context);
  166.  
  167. typedef GnomeVFSResult (* GnomeVFSMethodRemoveDirectoryFunc)
  168.                     (GnomeVFSMethod *method,
  169.                      GnomeVFSURI *uri,
  170.                      GnomeVFSContext *context);
  171.  
  172. typedef GnomeVFSResult (* GnomeVFSMethodMoveFunc)
  173.                     (GnomeVFSMethod *method,
  174.                      GnomeVFSURI *old_uri,
  175.                      GnomeVFSURI *new_uri,
  176.                      gboolean force_replace,
  177.                      GnomeVFSContext *context);
  178.  
  179. typedef GnomeVFSResult (* GnomeVFSMethodUnlinkFunc)
  180.                                         (GnomeVFSMethod *method,
  181.                      GnomeVFSURI *uri,
  182.                      GnomeVFSContext *context);
  183.  
  184. typedef GnomeVFSResult (* GnomeVFSMethodCheckSameFSFunc)
  185.                     (GnomeVFSMethod *method,
  186.                      GnomeVFSURI *a,
  187.                      GnomeVFSURI *b,
  188.                      gboolean *same_fs_return,
  189.                      GnomeVFSContext *context);
  190.  
  191. typedef GnomeVFSResult (* GnomeVFSMethodSetFileInfo)
  192.                     (GnomeVFSMethod *method,
  193.                      GnomeVFSURI *a,
  194.                      const GnomeVFSFileInfo *info,
  195.                      GnomeVFSSetFileInfoMask mask,
  196.                      GnomeVFSContext *context);
  197.  
  198. typedef GnomeVFSResult (* GnomeVFSMethodCreateSymbolicLinkFunc)
  199.                                         (GnomeVFSMethod *method,
  200.                                          GnomeVFSURI *uri,
  201.                                          const gchar *target_reference,
  202.                                          GnomeVFSContext *context);
  203. typedef GnomeVFSResult (* GnomeVFSMethodMonitorAddFunc)
  204.                          (GnomeVFSMethod *method,
  205.                            GnomeVFSMethodHandle **method_handle_return,
  206.                            GnomeVFSURI *uri,
  207.                            GnomeVFSMonitorType monitor_type);
  208.  
  209. typedef GnomeVFSResult (* GnomeVFSMethodMonitorCancelFunc)
  210.                          (GnomeVFSMethod *method,
  211.                            GnomeVFSMethodHandle *handle);
  212.  
  213. typedef GnomeVFSResult (* GnomeVFSMethodFileControlFunc)
  214.                          (GnomeVFSMethod *method,
  215.                            GnomeVFSMethodHandle *method_handle,
  216.                      const char *operation,
  217.                      gpointer operation_data,
  218.                      GnomeVFSContext *context);
  219.  
  220. typedef GnomeVFSResult (* GnomeVFSMethodForgetCacheFunc)
  221.                          (GnomeVFSMethod *method,
  222.                            GnomeVFSMethodHandle *method_handle,
  223.                      GnomeVFSFileOffset offset,
  224.                      GnomeVFSFileSize size);
  225.  
  226. typedef GnomeVFSResult (* GnomeVFSMethodGetVolumeFreeSpaceFunc)
  227.                          (GnomeVFSMethod *method,
  228.                      const GnomeVFSURI *uri,
  229.                       GnomeVFSFileSize *free_space);
  230.  
  231.  
  232. /* Use this macro to test whether a given function is implemented in
  233.  * a given GnomeVFSMethod.  Note that it checks the expected size of the structure
  234.  * prior to testing NULL.
  235.  */
  236.  
  237. #define VFS_METHOD_HAS_FUNC(method,func) ((((char *)&((method)->func)) - ((char *)(method)) < (method)->method_table_size) && method->func != NULL)
  238.  
  239. /* Structure defining an access method.     This is also defined as an
  240.    opaque type in `gnome-vfs-types.h'.    */
  241. struct GnomeVFSMethod {
  242.     gsize method_table_size;            /* Used for versioning */
  243.     GnomeVFSMethodOpenFunc open;
  244.     GnomeVFSMethodCreateFunc create;
  245.     GnomeVFSMethodCloseFunc close;
  246.     GnomeVFSMethodReadFunc read;
  247.     GnomeVFSMethodWriteFunc write;
  248.     GnomeVFSMethodSeekFunc seek;
  249.     GnomeVFSMethodTellFunc tell;
  250.     GnomeVFSMethodTruncateHandleFunc truncate_handle;
  251.     GnomeVFSMethodOpenDirectoryFunc open_directory;
  252.     GnomeVFSMethodCloseDirectoryFunc close_directory;
  253.     GnomeVFSMethodReadDirectoryFunc read_directory;
  254.     GnomeVFSMethodGetFileInfoFunc get_file_info;
  255.     GnomeVFSMethodGetFileInfoFromHandleFunc get_file_info_from_handle;
  256.     GnomeVFSMethodIsLocalFunc is_local;
  257.     GnomeVFSMethodMakeDirectoryFunc make_directory;
  258.     GnomeVFSMethodRemoveDirectoryFunc remove_directory;
  259.     GnomeVFSMethodMoveFunc move;
  260.     GnomeVFSMethodUnlinkFunc unlink;
  261.     GnomeVFSMethodCheckSameFSFunc check_same_fs;
  262.     GnomeVFSMethodSetFileInfo set_file_info;
  263.     GnomeVFSMethodTruncateFunc truncate;
  264.     GnomeVFSMethodFindDirectoryFunc find_directory;
  265.     GnomeVFSMethodCreateSymbolicLinkFunc create_symbolic_link;
  266.     GnomeVFSMethodMonitorAddFunc monitor_add;
  267.     GnomeVFSMethodMonitorCancelFunc monitor_cancel;
  268.     GnomeVFSMethodFileControlFunc file_control;
  269.     GnomeVFSMethodForgetCacheFunc forget_cache;
  270.     GnomeVFSMethodGetVolumeFreeSpaceFunc get_volume_free_space;
  271. };
  272.  
  273. gboolean       gnome_vfs_method_init   (void);
  274. GnomeVFSMethod    *gnome_vfs_method_get    (const gchar *name);
  275. GnomeVFSTransform *gnome_vfs_transform_get (const gchar *name);
  276.  
  277. G_END_DECLS
  278.  
  279. #endif /* GNOME_VFS_METHOD_H */
  280.